package com.wushijia.highconcurrency.utils;

import java.util.concurrent.ThreadPoolExecutor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ThreadPoolExecutorUtils {

  public static String getThreadPoolExecutorInfo(String threadPoolExecutorName, ThreadPoolExecutor executor) {
    return
        "[>>ExecutorStatus<<] ThreadPool Name: [{" + threadPoolExecutorName
            + "}], Pool Status: [shutdown={" + executor.isShutdown() + "}, Terminated={" + executor.isTerminated() + "}], Pool Thread Size: {" + executor.getPoolSize()
            + "}, Active Thread Count: {" + executor.getActiveCount() + "}, Task Count: {" + executor.getTaskCount() + "}, Tasks Completed: {" + executor.getCompletedTaskCount()
            + "}, Tasks in Queue: {" + executor.getQueue().size() + "}";
  }
}
